package day06;
/*
    常见的排序算法有：冒泡排序、快速排序、插入排序、希尔排序······
    Arrays.sort(arr);//自动对数组做升序排列
 */

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;

public class Demo04数组的排序 {
    public static void main(String[] args) {
        Random r = new Random();

        int[] arr = new int[5];

        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < 5; i++) {
            int num = r.nextInt(100);
            arr[i] = num;
        }
        System.out.println(Arrays.toString(arr));

        Arrays.sort(arr);
        System.out.println("升序排序后数组");
        System.out.println(Arrays.toString(arr));

        System.out.println("降序排序后数组");
        for (int j = arr.length - 1; j >= 0; j--) {
            arrayList.add(arr[j]);
            //Arrays.sort(brr[i], Collections.reverseOrder());
        }
        System.out.println(arrayList);
    }
}
